<?php
declare (strict_types=1);

namespace app\admin\controller;

use addons\Builder\facade\Builder;

class Express extends Base
{
    //主键，默认为id
    protected string $pk = 'id';

    //主模型
    protected string $model = '\app\common\model\Express';

    //验证器
    protected string $validate = 'Express';

    public function index(): string
    {
        return Builder::Table()
            ->addColumn(['type' => 'checkbox', 'fixed' => 'left', 'title' => '全选'])
            ->addColumn(['field' => 'id', 'title' => '标识ID', 'width' => 80])
            ->addColumn(['field' => 'title', 'title' => '快递名称', 'modify' => '2,input'])
            ->addColumn(['field' => 'description', 'title' => '描述', 'modify' => '2,input'])
            ->addColumn(['field' => 'sort', 'title' => '排序', 'modify' => '2,number', 'templet' => '#sort_sort', 'width' => 120])
            ->addColumn(['field' => 'create_time', 'title' => '创建时间'])
            ->addColumn(['field' => 'update_time', 'title' => '更新时间'])
            ->addColumn(['field' => 'status', 'title' => '状态', 'templet' => '#statusTpl', 'width' => 120, 'unresize' => true])
            ->addColumn(['fixed' => 'right', 'align' => 'center', 'toolbar' => '#barDemo', 'title' => '操作', 'width' => 200])
            ->addRightButtons(['edit' => ['size' => '50%'], 'delete'])
            ->addTopButtons(['add' => ['size' => '50%'], 'deleteAll'])
            ->addSortTool([['name' => 'sort', 'pk' => $this->pk, 'url' => url('update')->build()]])
            ->addSearch([['title', '填写快递名称', 'input', '', '', '', 'like']])
            ->fetch();
    }

}
